$OpenBSD: patch-lib_rubygems_ext_ext_conf_builder_rb,v 1.1.1.1 2014/01/03 17:51:52 jeremy Exp $

Ugly hack to make --user-install option work.  Without this, when
a user uses gem install --user-install, it calls
/usr/bin/install -o root -g bin, which fails due to permission issues.
This removes the -o root -g bin, so it can succeed as a regular user.

--- lib/rubygems/ext/ext_conf_builder.rb.orig	Tue May 14 09:03:40 2013
+++ lib/rubygems/ext/ext_conf_builder.rb	Tue May 14 09:06:11 2013
@@ -22,6 +22,11 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
         siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
         siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
       end
+      unless Process.euid == 0
+        %w[INSTALL INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM].each do |ins|
+          siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{ins}'] = RbConfig::CONFIG['#{ins}'] = RbConfig::CONFIG['#{ins}'].gsub(/-o root -g bin/, '')"
+        end
+      end
 
       siteconf.flush
 
